package cn.big.bigd.biocode.util;


/**
 * Created by wangfan on 2017/12/5.
 */
public class StringUtil {


    public static String  generateAccession(long id){
        String newValue=String.valueOf(id);
        int size = 8-newValue.length();
        for(int j=0;j<size;j++){
            newValue="0"+newValue;
        }
        newValue="BT"+newValue;
        return newValue;
    }

    public static long  generateIdFromAccession(String accession){
        String value=accession.substring(2);
        long result = Long.parseLong(value);
        return result;
    }

    public static String hidden(String email) {
        String result;
        String arr[] = email.split("@");
        String pre = arr[0].replaceFirst(arr[0].substring(0,3), "***");
        System.out.println(pre);
        String suf = arr[1].replace(arr[1].substring(0,5), "***");

        result = pre+"@"+suf;

        return result;

    }
}
